<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>榆林市宏观经济监测预警系统</title>
<script type="text/javascript" src="${pageContext.request.contextPath}/resources/jquery/1.6/jquery.js"></script>
<style type="text/css">
<!--
body {
	background:#3c7fb5 url(/FPM/resources/images/bg_login.jpg) repeat-x left top;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
body,table,td,div {
	font-size: 12px;
	line-height: 24px;
}
.textfile {background:url(/FPM/resources/images/bg_login_textfile.gif) no-repeat left top; padding: 0px 2px; height: 29px; width: 143px; border: 0; }
.textfile1{background:url(/FPM/resources/images/bg_login_textfile1.gif) no-repeat left top; padding: 0px 2px; height: 29px; width: 60px; border: 0; }
-->
</style>
<script type="text/javascript">
$(document).ready(function(){
	guestLogin();
});
function guestLogin(){
	var guest = request('guest');
	if(guest == '1'){
		var formObj = document.getElementById("form1");
		jQuery('#usernameHidden').val('guest');
		jQuery('#passwordHidden').val('111111');
		formObj.action='j_spring_security_check';
		formObj.submit();
		
	}
}
function guestLoginNew(){
		var formObj = document.getElementById("form1");
		jQuery('#usernameHidden').val('guest');
		jQuery('#passwordHidden').val('111111');
		formObj.action='j_spring_security_check';
		formObj.submit();
		
}
$(function(){  
    $('#kaptchaImage').click(function () { $(this).attr('src', '${pageContext.request.contextPath}/login-code?' + Math.floor(Math.random()*100) ); })  
});  

function request(paras)     {         
	var url = location.href;        
	var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");      
	var paraObj = {} ;      
	for (var i=0; j=paraString[i]; i++){         
		paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length);         
		
	}         
	
	var returnValue = paraObj[paras.toLowerCase()];       
	if(typeof(returnValue)=="undefined"){    
		return "";        
		}else{       
			return returnValue;        
			}   
	}   

</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="j_spring_security_check">
<input type="hidden" id="usernameHidden" name="usernameHidden" value=""/>
<input type="hidden" id="passwordHidden" name="passwordHidden" value=""/>
<table width="95" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src="${pageContext.request.contextPath}/resources/images/top_login.jpg" width="596" height="331" /></td>
  </tr>
  <tr>
    <td>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="99"></td>
        <td background="${pageContext.request.contextPath}/resources/images/bg_form.jpg"><table width="250" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td height="35" align="right">用户名：</td>
            <td>
              	<label>
                	<input name="username" type="text" class="textfile" value="${name}"/>
                </label>            
           </td>
          </tr>
          <tr>
            <td height="35" align="right">密&nbsp;&nbsp;码：</td>
            <td>
	            <label>
	              	<input name="password" type="password" class="textfile" value="${pwd}"/>
	            </label>
            </td>
          </tr>
          <tr>
            <td height="35" align="right">验证码：</td>
            <td>
	            <label>
	              	<input name="code" type="text" id = "code" class="textfile1" value="${code}"/>
	              	<img style="width: 85px;height: 35px;vertical-align: middle" title="看不清?点击更换" src="${pageContext.request.contextPath}/login-code" id="kaptchaImage" />
	            </label>
	            
            </td>
          </tr>
          <tr>
          
            <td height="35"><input  type="submit" name="Submit" value="登录" />	
				</td>
            <td >
	            <label>
	              <input style="height: 35" type="reset" name="Submit2" value="重置" />&nbsp;&nbsp;
	              <input  type="button" name="Submit1" onclick="guestLoginNew();" value="游客界面" /> 
	            </label>
            </td>           
          </tr>
          <tr>
          	<td colspan="2" align="center">
	            <c:if test="${error==true}">
	              		<label style="color: red">登录失败，您输入了无效的信息!</label>
	            </c:if>
            </td>
          </tr>
        </table></td>
        <td width="98" align="right"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><img src="${pageContext.request.contextPath}/resources/images/bottom_login.jpg" width="596" height="39" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="center">版权所有：曙溪计算机信息有限公司</td>
  </tr>
</table>
</form>
</body>
</html>
